<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
{eval $user=$this->user; $setting=$this->setting;}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Tipask's Control Panel</title>
<meta http-equiv="Content-Type" content="text/html; charset={TIPASK_CHARSET}">
<link media="all" type="text/css" href="css/common/admin/admincp.css" rel="stylesheet"/>
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/admin.js" type="text/javascript"></script>
<SCRIPT src="js/calendar.js" type="text/javascript"></SCRIPT>
</head>
<body>
<div id="append">
</div>
<div class="container">
	<!--{if isset($message)}-->
		<!--{eval $type=isset($type)?$type:'correctmsg'; }-->
		<div class="{$type}"><p>{$message}</p></div>
	<!--{/if}-->
	<div class="mainbox nomargin">
		<form {if isset($ad)}action="index.php?admin_ad/edit{$setting['seo_suffix']}"{else}action="index.php?admin_ad/add{$setting['seo_suffix']}"{/if} method="post">
			<table class="opt">
				<tr>
					<th colspan="2">广告类型:</th>
				</tr>
				<tr>
					<td>
					<select name="type">
						<option value="0" {if isset($ad['type'])&&$ad['type']==0}selected{/if}>首页通栏广告</option>
						<option value="1" {if isset($ad['type'])&&$ad['type']==1}selected{/if}>首页页尾广告</option>
						<option value="2" {if isset($ad['type'])&&$ad['type']==2}selected{/if}>首页栏目间广告1</option>
						<option value="3" {if isset($ad['type'])&&$ad['type']==3}selected{/if}>首页栏目间广告2</option>
						<option value="4" {if isset($ad['type'])&&$ad['type']==4}selected{/if}>首页栏目间广告3</option>
						<option value="5" {if isset($ad['type'])&&$ad['type']==5}selected{/if}>首页栏目右侧广告</option>
						<option value="6" {if isset($ad['type'])&&$ad['type']==6}selected{/if}>浏览问题正文内广告</option>
						<option value="7" {if isset($ad['type'])&&$ad['type']==7}selected{/if}>浏览分类通栏广告</option>
					</select>
					</td>
					<td valign="top">选择你要添加的广告类型。</td>
				</tr>
				<tr>
					<th colspan="2">广告标题:</th>
				</tr>
				<tr>
					<td><input class="txt"  name="title" style="width:300px;" {if isset($ad['title'])}value="{$ad['title']}"{/if} ></td>
					<td valign="top">注意: 广告标题只为识别辨认不同广告条目之用，并不在广告中显示。</td>
				</tr>
				<tr>
					<th colspan="2">广告起始时间(选填):</th>
				</tr>
				<tr>
					<td><input class="txt"  readonly name="starttime" onclick="showcalendar();" style="width:300px;" {if isset($ad['starttime']) && $ad['starttime']}value="{$ad['fstarttime']}"{/if}></td>
					<td valign="top">设置广告起始生效的时间，格式 yyyy-mm-dd，留空为不限制起始时间。</td>
				</tr>
				<tr>
					<th colspan="2">广告结束时间(选填):</th>
				</tr>
				<tr>
					<td><input class="txt" readonly  name="endtime" style="width:300px;" onclick="showcalendar();"  {if isset($ad['endtime']) && $ad['endtime']}value="{$ad['fendtime']}"{/if}></td>
					<td valign="top">设置广告广告结束的时间，格式 yyyy-mm-dd，留空为不限制结束时间。</td>
				</tr>
				<tr>
					<th colspan="2">展现方式:</th>
				</tr>
				<tr>
					<td>
						<select id="advstyle" name="style"  onchange="show_param();">
							<option value="code" {if (isset($ad)&& 'code' == $ad['parameters']['style'])} selected {/if}> 代码</option>
							<option value="text" {if (isset($ad)&& 'text' == $ad['parameters']['style'])} selected {/if}> 文字</option>
							<option value="image" {if (isset($ad)&& 'image' == $ad['parameters']['style'])} selected {/if}> 图片</option>
							<option value="flash" {if (isset($ad)&& 'flash' == $ad['parameters']['style'])} selected {/if}> Flash</option>
						</select>
					</td>
					<td valign="top">请选择所需的广告展现方式。</td>
				</tr>
			<tbody id="style_code" {if (!isset($ad) || 'code' == $ad['parameters']['style'])}style="display: block;"{else}style="display: none;"{/if}>
				<tr>
					<th colspan="2">HTML 代码 :</th>
				</tr>
				<tr>
					<td><textarea class="textarea" cols="80" name="html" rows="10">{if isset($ad['code'])}{$ad['code']}{/if}</textarea></td>
					<td valign="top">请直接输入需要展现的广告的 HTML 代码</td>
				</tr>
			</tbody>
			<tbody id="style_text" {if (isset($ad)&& 'text' == $ad['parameters']['style'])}style="display: block;"{else}style="display: none;"{/if}>
				<tr>
					<th colspan="2">文字内容(必填):</th>
				</tr>
				<tr>
					<td><input class="txt"  name="textname" style="width:300px;" {if isset($ad['parameters']['textname'])}value="{$ad['parameters']['textname']}"{/if} ></td>
					<td valign="top">广告名称</td>
				</tr>
				<tr>
					<th colspan="2">文字链接(必填):</th>
				</tr>
				<tr>
					<td><input class="txt"  name="texturl" style="width:300px;" {if isset($ad['parameters']['texturl'])}value="{$ad['parameters']['texturl']}"{else}value="http://"{/if} ></td>
					<td valign="top">广告链接地址</td>
				</tr>
			</tbody>
			<tbody id="style_image" {if (isset($ad)&& 'image' == $ad['parameters']['style'])}style="display: block;"{else}style="display: none;"{/if}>
				<tr>
					<th colspan="2">图片地址(必填):</th>
				</tr>
				<tr>
					<td><input class="txt"  name="imageurl" style="width:300px;" {if isset($ad['parameters']['imgurl'])}value="{$ad['parameters']['imgurl']}"{/if} ></td>
					<td valign="top">请输入图片广告的图片调用地址 </td>
				</tr>
				<tr>
					<th colspan="2">图片地址(必填):</th>
				</tr>
				<tr>
					<td><input class="txt"  name="imageadurl" style="width:300px;" {if isset($ad['parameters']['imgadurl'])}value="{$ad['parameters']['imgadurl']}"{/if} ></td>
					<td valign="top">请输入图片广告指向的 URL 链接地址 </td>
				</tr>
				<tr>
					<th colspan="2">图片宽度(选填):</th>
				</tr>
				<tr>
					<td><input class="txt"  name="imagewidth" style="width:300px;" {if isset($ad['parameters']['imagewidth'])}value="{$ad['parameters']['imagewidth']}"{/if} ></td>
					<td valign="top">请输入图片广告的宽度，单位为像素 </td>
				</tr>
				<tr>
					<th colspan="2">图片高度(选填):</th>
				</tr>
				<tr>
					<td><input class="txt"  name="imageheight" style="width:300px;" {if isset($ad['parameters']['imageheight'])}value="{$ad['parameters']['imageheight']}"{/if} ></td>
					<td valign="top">请输入图片广告的高度，单位为像素</td>
				</tr>
			</tbody>
			<tbody id="style_flash" {if (isset($ad)&& 'flash' == $ad['parameters']['style'])}style="display: block;"{else}style="display: none;"{/if}>
				<tr>
					<th colspan="2">Flash 地址(必填):</th>
				</tr>
				<tr>
					<td><input class="txt"  name="flashurl" style="width:300px;" {if isset($ad['parameters']['flashurl'])}value="{$ad['parameters']['flashurl']}"{/if}></td>
					<td valign="top">请输入 Flash 广告的调用地址</td>
				</tr>
				<tr>
					<th colspan="2">Flash 宽度(必填):</th>
				</tr>
				<tr>
					<td><input class="txt"  name="flashwidth" style="width:300px;" {if isset($ad['parameters']['flashwidth'])}value="{$ad['parameters']['flashwidth']}"{/if}></td>
					<td valign="top">请输入 Flash 广告的宽度，单位为像素</td>
				</tr>
				<tr>
					<th colspan="2">Flash 高度(必填):</th>
				</tr>
				<tr>
					<td><input class="txt"  name="flashheight" style="width:300px;" {if isset($ad['parameters']['flashheight'])}value="{$ad['parameters']['flashheight']}"{/if}></td>
					<td valign="top">请输入 Flash 广告的高度，单位为像素</td>
				</tr>
			</tbody>
			</table>
			<div class="opt">
				{if isset($ad)}<input type="hidden" name="advid" value="$ad['advid']"/>{/if}
				<input class="btn" tabindex="3" type="submit" value=" 提 交 " name="submit">
			</div>
		</form>
	</div>
</div>

</body>
<script type="text/javascript">
function show_param(){
	var styles, key;
	styles=new Array('code','text','image','flash'); 
	var adstyle = $('#advstyle').val();
	for(key in styles) {
		var obj=$('#style_'+styles[key]);
		var dis=styles[key]==adstyle?'block':'none';
		obj.css('display',dis);
	 }
}
</script>
</html>
